package com.mls.fivedistrict.controller.backend;


import com.baomidou.mybatisplus.plugins.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mls.fivedistrict.common.PageFilter;
import com.mls.fivedistrict.common.RequestHolder;
import com.mls.fivedistrict.common.ServiceResponse;
import com.mls.fivedistrict.pojo.UserVoteOption;
import com.mls.fivedistrict.server.UserVoteOptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户投票选项表 前端控制器
 * </p>
 *
 * @author Five Team
 * @since 2018-05-21
 */
@RestController
@RequestMapping("/api/manager")
public class UserVoteOptionController {
    @Autowired
    private UserVoteOptionService userVoteOptionService;

    @RequestMapping("/v1/userVoteOptions")
    public ServiceResponse userList() {
        PageFilter pageFilter = RequestHolder.getPageFilter();
        PageHelper.startPage(pageFilter.getPageNum(), pageFilter.getPageSize());

//        List<User> userList = userVoteOp.getVoteUserList(pageFilter);

        Page page = new Page(pageFilter.getPageNum(), pageFilter.getPageSize());
        List<UserVoteOption> userVoteOptionList = userVoteOptionService.selectListDetail(pageFilter.getWrapper());
        return ServiceResponse.createSuccessResponse(page);
    }

}

